package com.rabbitMq.consumer.controller;


import com.rabbitMq.consumer.service.RabbitMqListenerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
public class ConsumerController {

    private final RabbitMqListenerService rabbitMqListenerService;

    @Autowired
    public ConsumerController(RabbitMqListenerService rabbitMqListenerService) {
        this.rabbitMqListenerService = rabbitMqListenerService;
    }


    @GetMapping("")
    public String Index() {
        return "Index";
    }


    @PostMapping("getReceivingQuantity")
    @ResponseBody
    public Map<String, Object> getReceivingQuantity() {
        return rabbitMqListenerService.getReceivingQuantity();
    }

}
